<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateCategoriesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('categories', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('name')->comment('栏目名称');
            $table->unsignedBigInteger('parent_id')->comment('栏目父id')->nullable();
            $table->boolean('is_directory')->comment('栏目是否是目录');
            $table->unsignedTinyInteger('level')->comment('栏目等级');
            $table->string('path')->comment('当前栏目的所有父id');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('categories');
    }
}
